package xinxin.com.StrategyPattern.CashContext;

import xinxin.com.StrategyPattern.Cash.CashNormal;
import xinxin.com.StrategyPattern.Cash.CashRebate;
import xinxin.com.StrategyPattern.Cash.CashReturn;
import xinxin.com.StrategyPattern.Cash.CashSuper;

public class CashContext {
    private CashSuper cs;

    public CashContext(String type) {
        switch (type) {
            case "正常收费":
                cs = new CashNormal();
                break;
            case "满300返100":
                cs = new CashReturn(300, 100);
                break;
            case "打八折":
                cs = new CashRebate(0.8);
                break;
        }
    }
    public double GetResult(double money) {
        return cs.acceptCash(money);
    }
}
